package com.twu.biblioteca;

public class Book{

    private String name;
    private String author;
    private String yearPublished;

    public Book(String name, String author, String yearPublished) {
        this.name = name;
        this.author = author;
        this.yearPublished = yearPublished;

    }

    public String getName() {
        return this.name;
    }

    public String getAuthor() {
        return this.author;
    }

    public String getYearPublished() {
        return this.yearPublished;
    }

    @Override
    public String toString() {
        return name + "     " + author + "         " + yearPublished;
    }

    @Override
    public boolean equals(Object other) {
        if(other == this)
            return true;

        if(!(other instanceof Book))
            return false;

        Book otherBook = (Book) other;

        return name.equals(otherBook.name) &&
                author.equals(otherBook.author) &&
                yearPublished.equals(otherBook.yearPublished);

    }
}

